package com.nowcoder.community.entity;

import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.util.Date;

@Document(indexName = "discusspost",type = "_doc",shards = 6,replicas = 3)
@Data
public class DiscussPost {

    //声明主键
    @Id
    private Integer id;

    //普通字段
    @Field(type = FieldType.Integer)
    private Integer userId;

    //analyser 存储字词解析， searchAnalyser 搜索字词解析器
    //ik_max_word 最大字词拆分进行存储（方便多方面进行被搜索），ik_smart 智能的拆分（搜索的时候使用）
    //比如：互联网校招
    //ik_max_word 互联，联网，网校，校招，互联网
    //ik_smart 互联网，校招
    @Field(type = FieldType.Text,analyzer = "ik_max_word",searchAnalyzer = "ik_smart")
    private String title;

    @Field(type = FieldType.Text,analyzer = "ik_max_word",searchAnalyzer = "ik_smart")
    private String content;

    @Field(type = FieldType.Integer)
    private Integer type;

    @Field(type = FieldType.Integer)
    private Integer status;

    @Field(type = FieldType.Date)
    private Date createTime;

    @Field(type = FieldType.Integer)
    private Integer commentCount;

    @Field(type = FieldType.Double)
    private double score;
}
